import 'package:flutter/material.dart';
import 'package:flutter_kit_plus/flutter_kit.dart';

class SliderItem extends StatefulWidget {
  String icon1 = '';
  String icon2 = '';
  double currentValue = 1;
  double min = 0;
  double max = 100;
  Function(double) onChanged;
  SliderItem(
      {super.key,
      required this.icon1,
      required this.icon2,
      required this.currentValue,
      required this.min,
      required this.max,
      required this.onChanged});

  @override
  State<SliderItem> createState() => _SliderItemState();
}

class _SliderItemState extends State<SliderItem> {
  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
      return Column(
        children: [
          Image.asset(widget.icon1, width: 20),
          const SizedBox(height: 5),
          Expanded(
              child: kSlider(
            dirction: Axis.horizontal,
            value: widget.currentValue,
            min: widget.min,
            max: widget.max,
            onChangedForSend: (p0) => widget.onChanged(p0),
          )),
          const SizedBox(height: 5),
          Image.asset(widget.icon2, width: 16),
        ],
      );
    });
  }
}
